home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / 80X86 / DOS32V33.ZIP / EXAMPLES / VIDEO.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-07-27  |  2.2 KB  |  71 lines

  1. comment ~
  2.   ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙
  3. ∙░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░∙
  4. ∙░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░∙
  5. ∙░░▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒░░∙
  6. ∙░░▒▒▓▓   Examples showing how to access physical memory located      ▓▓▒▒░░∙
  7. ∙░░▒▒▓▓   in the lowwer 1Mb.                                          ▓▓▒▒░░∙
  8. ∙░░▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒░░∙
  9. ∙░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░∙
  10. ∙░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░∙
  11.  ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙ ∙
  12. ~
  13. .386
  14. .model flat
  15. .stack
  16. .code
  17.  
  18. start:
  19.         Mov     Ax,0EE02h               ; GET DOS32 ADDRESS INFORMATION
  20.         Int     31h
  21.  
  22.    ; This DOS32 call returns EBX with base address of the program segment.
  23.    ; An offset address may be calulated so that it points to a linear
  24.    ; address anywhere in memory by the expresion below.
  25.    ;
  26.    ;             Linear address = segment base address + offset in segment
  27.    ;
  28.    ; Thus       offset in segment = Linear address - segment base address
  29.    ;
  30.    ;   However the first 1024Kb of Linear Address is maped directly
  31.    ;   to the first 1024Kb of physical memory.
  32.    ;
  33.    ; therfore:     offset = phisical address wanted - EBX
  34.    ;
  35.  
  36.  
  37.  
  38.    ; How to plot the character 'A' on the screen.  Lets make EDI equal an
  39.    ; offset so that it will point to physical location 0B8000h.
  40.  
  41.         MOV     EDI,0B8000h
  42.         SUB     EDI,EBX
  43.         MOV     BYTE PTR [EDI],'A'
  44.  
  45.  
  46.    ;
  47.    ; filling the screen with blue '' characters
  48.    ;
  49.         MOV     EDI,0B8000h
  50.         SUB     EDI,EBX
  51.         MOV     AX,0101h
  52.         MOV     ECX,2000
  53.         REP     STOSW
  54.  
  55.  
  56.    ;
  57.    ; Reading the BIOS data area to find the base port address of LPT1
  58.    ;
  59.  
  60.         MOV     EDI,0000
  61.         SUB     EDI,EBX
  62.         MOV     AX,[EDI+405h]           ; AX = LPT1 base port
  63.  
  64.  
  65.  
  66.         MOV     AX,4C00h                ; Terminate with error code 0
  67.         INT     21h
  68.  
  69.  
  70. end start
  71.